<% prefix = prefix + "[]" %>
<% fields_for prefix, contained_item_form do |c_i| %>
	<div class="contained-item">
		<%= c_i.error_messages %>
		<%= c_i.hidden_field(:source_id, :value => @source_id) %>
		<%= c_i.hidden_field(:client_id, :value => @client_id) %>
		<div class="contained-item-row">
			<div class="left">
				<%= c_i.label :item_type, "Item Type" %><span class="required">required</span>
			</div>
			<div class="right">
				<div class="single">
					<%= c_i.collection_select :item_type_id, @contained_types, :id, :item_type, { :prompt => :true } %>
				</div>
				<span class='remove_item_from_container'%>
					<%= link_to_function "remove", "$(this).up('.contained-item').remove();" %>
				</span>
			</div>
		</div>
		<div class="contained-item-row">
			<div class="left">
				<%= c_i.label "Identifier" %><span class="optional">(optional)</span>
			</div>
			<div class="right">
				<div class="single">
					<% fields_for prefix + "[identifiers_attributes][0]", contained_item_form.identifiers.first do |i| %>
						<%= i.text_field :identifier_value %>
						<%= i.hidden_field :identifier_type, :value => 'barcode' %>
					<% end %>
				</div>
			</div>
		</div>
		<%= render :partial => "item_attributes", :collection => contained_item_form.item_attribute_values, 
					:locals => {:prefix => prefix, :row_class => "contained-item-row",
					:attribute_map => create_item_attribute_map(ItemAttributeSet.find_all_by_inherits_from_container_and_hidden(false, false))} %>
		<div class="contained-item-row">
			<div class="left">
				<%= c_i.label "Comments" %><span class="optional">(optional)</span>
			</div>
			<div class="right">
				<div class="single">
					<% fields_for prefix + "[comments_attributes][0]", contained_item_form.comments.first do |c| %>
						<%= c.text_area :text %>
						<%= c.hidden_field :user_id, :value => @client_id %>
					<% end %>
				</div>
			</div>
		</div>
	</div>
<% end %>